<template>
 
</template>
<script>

import { Dialog } from 'element-ui';
import {getList}　from "@/api/Car";

export default {
  data() {
    return {
      inputModel: {
        name: '',
        bianma: '',
        delivery: true,
        direction: '',
        purview: '',
      },
      inputShebId: 0,
      list: [{
        id: 0,
        shebType: '',
        shebName: '',
        shebId: '',
        fangx: '',
      }, {
        id: 1,
        shebType: '',
        shebName: '',
        shebId: '',
        fangx: '',
      }],
      rules: {
        name: [{ required: true, message: '请输入门禁名称', trigger: 'blur' },
        { min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' }],
        fangx: [{ required: true, message: '请选择方向', trigger: 'blur' }]
      },
      rules1: {
        shebType: [{ required: true, message: '请选择设备类型', trigger: 'blur' }],
        shebName: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
        shebId: [{ required: true, message: '请输入设备Id', trigger: 'blur' }],
        fangx: [{ required: true, message: '请选择方向', trigger: 'blur' }]
      },
      directionList: [{ value: 0, label: '请选择' }, { value: 1, label: '进场' }, { value: 2, label: '出场' }, { value: 3, label: '双向' }],
      purviewList: [{ value: 0, label: '请选择' }, { value: 1, label: '收费进出场' }],
      equipmentTypeList: [{ value: 0, label: '请选择' }, { value: 1, label: '摄像头' }, { value: 2, label: 'LED屏' }],
      equipmentList: [{
        id: 0,
        shebName: "东大门1号摄像头",
        ipName: "10.1.1.12",
        userName: "admin",
        password: "123",
      }, {
        id: 1,
        shebName: "东大门2号摄像头",
        ipName: "10.1.1.13",
        userName: "admin",
        password: "123",
      }, {
        id: 2,
        shebName: "东大门3号摄像头",
        ipName: "10.1.1.14",
        userName: "admin",
        password: "123",
      }],
      listLoading: false,
      labelWidth: "80px",
      labelHeight: "32px",
      addCount: 2,
      dialogFormVisible: false,
      searchModel: { name: "" },
      dataListSelections: [],
      count: 0,
      currentPage: 1,
      total: 20,
      pageSize: 5,
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      getList().then(res=>{
        console.log('获取列表',res)
      })
    },
    addDevice() {
      this.list.push({
        id: this.addCount,
        shebType: '',
        shebName: '',
        shebId: '',
        fangx: '',
      })
      this.addCount++;
    },
    deleteDevice(id) {
      let list1 = [];
      this.list.forEach(item => {
        if (item.id != id) {
          list1.push(item);
        }
      });
      this.list = list1;
    },
    clearDevuce() {
      this.list = [{
        id: 0,
        shebType: '',
        shebName: '',
        shebId: '',
        fangx: '',
      }, {
        id: 1,
        shebType: '',
        shebName: '',
        shebId: '',
        fangx: '',
      }]
    },
    handleDownload() { },
    dialogStartUp(id) {
      this.dialogFormVisible = true;
      this.inputShebId = id;
    },
    dialogDetermine() {

      this.list.forEach(item => {
        if (this.inputShebId === item.id) {
          item.shebName = this.dataListSelections.shebName;
          item.shebId = this.dataListSelections.ipName;
        }
      });
      this.dialogFormVisible = false;
    },
    selectionChangeHandle(val) {
      this.dataListSelections = val
      console.log(this.dataListSelections);
    },
    handleCurrentChange() {

    },
    handleSizeChange() {

    },
  }
}
</script>

<style lang="scss" scoped>
.main {
  margin: 0.2rem;
  padding: 0.2rem;
}

.search-bar {
  margin-bottom: .2rem;
  text-align: left;
  float: left;
  margin-left: 8rem;
  margin-top: 2rem;
}

.p {
  font-size: 23px;
}

.move-right {
  // width: 180px;
  // height: 30px;
  margin-bottom: 1px;
  // margin-right: 20rem;
  float: right;
}

.dialog-button {
  height: 40px;
  width: 200px;
  float: right;
}

.input-width {
  width: 202px;
}

.block {
  margin-right: 2rem;
  float: right;
}

.interval-top {
  margin-top: 1.6rem;
}
</style>
